# -*- coding: utf-8 -*-

"""
DateTime   : 2020/12/17 15:49
Author     : ZhangYafei
Description: 普通类装饰器
"""
import time


class RecordTime(object):
    def __init__(self, func):
        self._func = func

    def __call__(self):
        start_time = time.time()
        self._func()
        end_time = time.time()
        print('spend is {}'.format(end_time - start_time))


@RecordTime  # bar = RecordTime(bar)
def func():
    print('func..')
    time.sleep(2)


func()
"""
func..
spend is 2.0018553733825684
"""

